﻿using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using System.IO;
using DevExpress.Xpo;
using System.ComponentModel;
using DevExpress.ExpressApp.Utils;
using DevExpress.Persistent.Validation;
using DomainComponents.Common;

namespace DomainComponents.XCRM {
    public class NoteValidationRules {
        public const string NoteTitleIsRequired = "NoteTitleIsRequired";
    }

    [DomainComponent]
    [XafDefaultProperty("Title")]
    [XafDisplayName("Note")]
    public interface INote {
        [RuleRequiredField(NoteValidationRules.NoteTitleIsRequired, DefaultContexts.Save)]
        [FieldSize(255)]
        string Title { get; set; }

        [FieldSize(4000)]
        string Description { get; set; }
        
        IPersistentFileData Attachment { get; set; }
    }

    [DomainComponent]
    public interface INotes {
        [DevExpress.ExpressApp.DC.Aggregated]
        IList<INote> Notes { get; }
    }
}
